﻿#ifndef SEMAPHORE_H
#define SEMAPHORE_H

#include <stdint.h>
#include <Windows.h>

namespace RemoteObj
{
#define REMOTEOBJ_SEM_WAIT_INFINITE INFINITE
#define remote_obj_sem_t HANDLE

class Semaphore
{
public:
    Semaphore(int32_t init_size = 0);
    virtual ~Semaphore();
    int32_t wait(uint32_t millisecond = REMOTEOBJ_SEM_WAIT_INFINITE);
    int32_t signal();
protected:
    Semaphore(const Semaphore&);
    Semaphore& operator=(const Semaphore&);
private:
    remote_obj_sem_t _sem;
};
}

#endif // SEMAPHORE_H
